package view;

import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;

public class GLSurface extends GLSurfaceView
{
	private final SnippetRenderer renderer;
	
	public GLSurface(Context context) 
	{
		super(context);
		
		renderer = new SnippetRenderer();
		init(context);
	}

	public GLSurface(Context context, AttributeSet attrs) 
	{
		super(context, attrs);
		
		renderer = new SnippetRenderer();
                
        init(context);
    }
    
    private void init(Context context)
    {
    	setEGLConfigChooser(8,8,8,8,16,0);
        setEGLContextClientVersion(2);
        
        setZOrderMediaOverlay(true);
        
        // Set the Renderer for drawing on the GLSurfaceView        
        setRenderer(renderer);
        // Render the view only when there is a change in the drawing data
        setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
        
        getHolder().setFormat( PixelFormat.TRANSLUCENT);
    }

	public SnippetRenderer getRenderer() {
		return renderer;
	}

}
